package leetcode.list;

public class Lc2095 {

    public ListNode deleteMiddle(ListNode head) {
        if (head.next == null) return null;
        ListNode slow = head, fast = head, slowPre = null;
        ListNode origin = head;
        while (fast != null && fast.next != null) {
            slowPre = slow;
            slow = slow.next;
            fast = fast.next.next;
        }
        slowPre.next = slow.next;
        return origin;
    }

}
